<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>统计包含“a”或“A”的字符串的个数</title>

    <script>
       var a=["America","Greece","Britain","Canada","China","Egypt","France","Japan","Angela","666"];
        var num=0;
        for(var i in a){
            if((a[i].indexOf("a")>=0)||(a[i].indexOf("A")>=0)){
                document.write(a[i]+"<br/>");
                num++;
            }
        }

        document.write("数组长度："+a.length+"<br/>共有"+num+"个字符串中包含a或A。")




    </script>

</head>
<body>

</body>
</html>